From f81d0504b122a29ee7a3b41b672f342a319c9ae3 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 7 Aug 2009 17:29:50 +0000 Subject: [PATCH] (mail-yank-original): Set buffer-file-coding-system from the one used by the message whose text is yanked. --- lisp/mail/sendmail.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el index b392ddcfac7..09028a37628 100644 --- a/lisp/mail/sendmail.el +++ b/lisp/mail/sendmail.el @@ -1506,7 +1506,19 @@ and don't delete any header fields." (delete-windows-on original t) (with-no-warnings ;; We really want this to set mark. - (insert-buffer original)) + (insert-buffer original) + ;; If they yank the original text, the encoding of the + ;; original message is a better default than + ;; default-buffer-file-coding-system. + (and (coding-system-equal + (default-value 'buffer-file-coding-system) + buffer-file-coding-system) + (setq buffer-file-coding-system + (coding-system-change-text-conversion + buffer-file-coding-system + (coding-system-base + (with-current-buffer original + buffer-file-coding-system)))))) (set-text-properties (point) (mark t) nil)) (if (consp arg) nil -- 2.30.2